package com.training.java.corejava.collections;

//import java.util.ArrayList;
//import java.util.Iterator;
//import java.util.List;
import java.util.*;

public class CarCollectionDemo {

	public static void main(String[] args) 
	{
		Car car1= new Car("Toyota","Corolla",2010);
		Car car2=new Car("Honda","CRV",2012);
		Car car3 = new Car("Ford","focus",2007);
		
		car1.setPrice(18000);
		car2.setPrice(25000);
		car3.setPrice(20000);
		
		List carList= new ArrayList();
		carList.add(car1);
		carList.add(car2);
		carList.add(car3);
		
		Iterator ite = carList.listIterator();
		       while(ite.hasNext())
		       {
		    	   Car aCar=(Car)ite.next();
		    	   System.out.println("Make:  " + aCar.getMake());
		    	   System.out.println("Model: " + aCar.getModel());
		    	   System.out.println("Year: " + aCar.getYear());
		    	   System.out.println("Price: " + aCar.getPrice());
		    	   System.out.println("************"); 
		    	   
		       }

		       
	}

}
